﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data.Common;

namespace Bzure.Apps.Security.DataAccess
{
    /// <summary>
    /// 数据库连接工厂
    /// </summary>
    public static class ConnectionFactory
    {

        private static string _connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityAppConnection"].ConnectionString;
        public static System.Data.Common.DbConnection GetConnection()
        {
            if (ApplicationStartContextSecurityCommonExtensions.connectionBuilder != default(Func<System.Data.Common.DbConnection>))
                return ApplicationStartContextSecurityCommonExtensions.connectionBuilder();
                return new SqlConnection(_connectionString);
        }
    }
}
